<template>
	<view class="container-tab">
		<view v-for="(data,index) in datas" :key="index" @click="tabClick(index)" :class='["container-tab-item",curryTabIndex ===index?"container-tab-item-activate":""]'>
			<u-icon v-if="data.type==='icon'" :size="data.size === undefined ? 25 : data.size" :name="data.icon"></u-icon>
			<text v-else>{{data.text}}</text>
		</view>
	</view>
</template>

<script>
	export default{
		props:{
			datas:{
				type:Array,
				default:()=>[],
			},
			tabFunc:Function
		},
		data(){
			return {
				curryTabIndex:0,
			}
		},
		methods:{
			tabClick(index){
				this.curryTabIndex = index;
				let parent = this.$parent;
				this.tabFunc && this.tabFunc.apply(parent,[index]);
			}
		}
	}
</script>

<style>
</style>